using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MonoCash
{

    public partial class SimpleTableEditor : Form
    {
        public SimpleTableEditor()
        {
            InitializeComponent();
        }
        public SimpleTableEditor(string TableName)
        {
            InitializeComponent();

            Text = TableName;

            string objectName = TableName.Substring(0, TableName.Length - 1);
            if (objectName.EndsWith("ie"))
            {
                objectName = objectName.Substring(0, objectName.Length - 2) + "y";
            }
            ObjectModel.ObjectModel o = (ObjectModel.ObjectModel)Activator.CreateInstance(Type.GetType("MonoCash.ObjectModel." + objectName));
            odgvTable.DataSource = o.GetType().GetProperty(TableName).GetValue(o, null);
            //odgvTable.DataSource = Program.AppSettings.Data.GetDataTable(TableName);
        }


    }
}